<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<%@ include file="/web/header.jsp"%>
<title>订单中心</title>
</head>
<body>

<%@ include file="/web/front/title/start.jsp"%>

<div class="grzxbj">
		<div class="selfinfo center">
		<div class="lfnav fl">
			<div class="ddzx">订单中心</div>
			<div class="subddzx">
				<ul>
					<li><a href="" style="color:#ff6700;font-weight:bold;">我的订单</a></li>
					<li><a href="">意外保</a></li>
					<li><a href="">团购订单</a></li>
					<li><a href="">评价晒单</a></li>
				</ul>
			</div>
			<div class="ddzx">个人中心</div>
			<div class="subddzx">
				<ul>
					<li><a href="./selfinfo.jsp">我的个人中心</a></li>
					<li><a href="">消息通知</a></li>
					<li><a href="">优惠券</a></li>
					<li><a href="./myaddress.jsp">收货地址</a></li>
				</ul>
			</div>
		</div>
		<div class="rtcont fr">
			<div class="ddzxbt">交易订单</div>
			<div id ="myorder">
				
			</div>
		</div>
		<div class="clear"></div>
		</div>
	</div>
	
	<script type="text/javascript">
	init();
		function init(){
			ajax({},'/orderinfo/getAll.do','json',function(data){
				var html = '';
				var html2 = '';
				$.each(data,function(i,dom){
					html += "<div class='ddxq'>"
					html += "<div class='ddbk fl'>订单号:"+ dom.code +"</div>";
					html += "<div class='ztxx fr'>"
						 + "<ul><li class='ztxz'>${dom.status == 1 ?'已发货':'未发货'}</li>";
					html += "<li class='ztxz'>￥"+ dom.total +"</li><li class='ztxy'>"+ dom.date +"</li>";
					html += "<li class='ztxl'><a href='javascript:xiangqing(\"" + dom.code + "\")'>订单详情</a></li>"
						 +"<div class='clear'></div></ul></div></div>";
				})
				html2 += html;
				$("#myorder").html(html2);
			})
		}
		
		function xiangqing(code){
			ajax({orderCode:code},'/orderpro/getsel.do','json',function(data){
				var html = '';
				var html2 = '';
				$.each(data,function(i,dom){
					console.log(dom)
					html += "<div class='ddxq'>"
					html += "<div class='ddspt fl'><img src='/image/"+ dom.url +"' width='80px' height='80px'/></div>";
					html += "<div class='ddbh fl'>商品号:"+ dom.proCode +"</div>";
					html += "<div class='ztxx fr'>"
						 + "<ul><li class='ztxz'>"+ dom.proName +"</li>";
					html += "<li class='ztxz'>￥"+ dom.price +"</li><li class='ztxz'>"+ dom.numb +"</li>";
					html += "<li class='ztxl'><a href='javascript:init()'>返回</a></li>"
						 +"<div class='clear'></div></ul></div></div>";
				})
				html2 += html;
				$("#myorder").html(html2);
			})
		}
	</script>
</body>
</html>